package day_2022_12_to_3.day;

/**
 * @author haomin
 * @date 2022/12/06 18:19
 **/

import java.util.*;
public class Day12_6_Num1805 {
    class Solution {
        public int numDifferentIntegers(String word) {
            if(word.length() == 0) return 0;
            StringBuffer sb = new StringBuffer();
            for(int i = 0; i < word.length(); ++i) {
                char c = word.charAt(i);
                if(Character.isDigit(c)) sb.append(c);
                else sb.append(" ");
            }
            String[] strs = sb.toString().split(" ");
            Set<String> set = new HashSet<>();
            for(String s : strs) {
                if(s.length() != 0) {
                    int i = 0;
                    while(i < s.length() && s.charAt(i) == '0') {
                        i++;
                    }
                    s = s.substring(i);
                    set.add(s);
                }
            }
            return set.size();
        }
    }
}